<!--
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<div class="ddp-wrap-layout-popup" *ngIf="isShow">
  <div class="ddp-ui-layout-popup">
    <div class="ddp-box-popup3">
      <a href="javascript:" class="ddp-btn-close" (click)="close()"></a>
      <!-- title -->
      <div class="ddp-pop-title" *ngIf="mode === 'create'">{{'msg.nbook.ui.add.nbook.server' | translate}}</div>
      <div class="ddp-pop-title" *ngIf="mode === 'update'">{{'msg.nbook.ui.edit.nbook.server' | translate}}</div>
      <!-- //title -->
      <!-- detail -->
      <div class="ddp-box-detail">
        <div class="ddp-wrap-edit3 ddp-type">
          <label class="ddp-label-type">{{'msg.comm.th.type' | translate}}</label>
          <!-- edit option -->
          <div class="ddp-ui-edit-option">
            <!-- 선택시 ddp-selected 추가 -->
            <component-select [array]="notebookServerType"
                              [viewKey]="'value'"
                              (onSelected)="selectedLanguage($event)"
                              [defaultIndex]="defaultIndex"
                              [disabled]="disabledFlag"
                              [inline]="true">
            </component-select>
          </div>
          <!-- //edit option -->
        </div>
        <div class="ddp-clear">
          <div class="ddp-wrap-edit2" [class.ddp-error]="isUrlReqError || isUrlValidError">
            <label class="ddp-label-type">{{'msg.comm.th.url' | translate}}</label>
            <input type="text" class="ddp-input-type" placeholder="{{'msg.nbook.ui.url.ph' | translate}}"
                   [(ngModel)]="notebook.url" (ngModelChange)="notebook.url = $event; isUrlReqError = undefined; isUrlValidError = undefined;">
            <!-- error -->
            <span class="ddp-ui-error" *ngIf="isUrlReqError">{{'msg.storage.alert.url.required' | translate}}</span>
            <span class="ddp-ui-error" *ngIf="isUrlValidError">{{'msg.dp.ui.invalid.url' | translate}}</span>
            <!-- error -->
          </div>
        </div>
        <div class="ddp-wrap-edit2" [class.ddp-error]="isNameError">
          <label class="ddp-label-type">{{'msg.comm.ui.name' | translate}}</label>
          <input type="text" class="ddp-input-type" placeholder="{{'msg.comm.ui.create.name' | translate}}"
                 [(ngModel)]="notebook.name" (ngModelChange)="notebook.name = $event; isNameError = undefined;">
          <!-- error -->
          <span class="ddp-ui-error" *ngIf="isNameError">{{'msg.dp.alert.name.error' | translate}}</span>
          <!-- error -->
        </div>
        <div class="ddp-wrap-edit2">
          <label class="ddp-label-type">{{'msg.comm.ui.description' | translate}}</label>
          <input type="text" class="ddp-input-type" placeholder="{{'msg.comm.ui.create.desc' | translate}}" [(ngModel)]="notebook.description">
        </div>

      </div>
      <!-- detail -->

      <!-- button -->
      <div class="ddp-ui-buttons">
        <a href="javascript:" class="ddp-btn-type-popup" (click)="close()">{{'msg.comm.btn.cancl' | translate}}</a>
        <!-- disabled 시 ddp-disabled 추가 -->
        <a href="javascript:" class="ddp-btn-type-popup ddp-bg-black " (click)="confirm()">{{'msg.comm.btn.done' | translate}}</a>
      </div>
      <!-- //button -->
    </div>
  </div>
</div>
